<h1 id="ssh-copy-id">ssh-copy-id</h1>
<p>把本地的ssh公钥文件安装到远程主机对应的账户下</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>ssh-copy-id命令</strong> 可以把本地主机的公钥复制到远程主机的authorized_keys文件上，ssh-copy-id命令也会给远程主机的用户主目录（home）和<code>~/.ssh</code>, 和<code>~/.ssh/authorized_keys</code>设置合适的权限。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">ssh-copy-id [-i [identity_file]] [user@]machine</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-i：指定公钥文件</code></pre>
<h3 id="实例">实例</h3>
<p>1、把本地的ssh公钥文件安装到远程主机对应的账户下：</p>
<pre><code class="language-bash">ssh-copy-id user@server
ssh-copy-id -i ~/.ssh/id_rsa.pub user@server</code></pre>
<!-- Linux命令行搜索引擎：https://jaywcjlove.github.io/linux-command/ -->
